<template>
	<view class="container">
		<view class="title">
			{{info.message_title}}
		</view>
		<view class="content">
			<rich-text :nodes="info.message_content"></rich-text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:'',
				id:'',
				token:''
			}
		},
		onLoad: function(option) { //option为object类型，会序列化上个页面传递的参数
			console.log(option.id); //打印出上个页面传递的参数。
			this.id = option.id;
			uni.showLoading({
				title: "加载中...",
				mask: true
			})
			uni.getStorage({
				key: 'user_info',
				success: (res) => {
					this.token = res.data.token;
					this.getData();
				},
				fail() {
					uni.redirectTo({
						url: '../login/auth'
					});
				}
			});
		},
		methods: {
			getData() {
				this.$request('/api/wxapp/v2/mine/notice/detail', {
					'token': this.token,
					'rec_id': this.id
				}).then(res => {
					if (res.code === 1) {
						uni.hideLoading();
						this.info = res.data;
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.title{
		font-size: 22px;
		color: #333333;
		line-height: 28px;
		text-align: justify;
	}
	.container{
		padding: 0 20px;
	}
</style>
